<!DOCTYPE html>
<html xmlns:fb="http:/ogp.me/ns/fb#">
	<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# website: http://ogp.me/ns/website#">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title><?php echo $title; ?></title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<meta name="apple-mobile-web-app-title" content="Kênh Giới Trẻ" />

<?php
	foreach($meta as $name=>$content)
	{
		if($content)
		{
			echo "\t";
			echo meta($name, html_escape($content));
		}
	}
?>

	<meta property="og:site_name" content="<?= lang('site_name') ?>"/>
<?php
	foreach($meta as $name=>$content)
	{
		if($content)
		{
			echo "\t";
			echo '<meta property="og:'.$name.'" content="'.html_escape($content).'" />';
			echo "\n";
		}
	}
?>
<?php
	if(!empty($canonical))
	{
		echo "\n\t\t";
		echo link_tag(html_escape($canonical), 'canonical');
	}
	echo "\n";
?>

	<link rel="icon" type="image/png" href="<?= base_url(); ?>images/logo_icon.png" />

	<link rel="stylesheet" href="<?= base_url(); ?>assets/<?= $this->output->template_name() ?>/css/owl.carousel.css" media="all" />
	<link rel="stylesheet" href="<?= base_url(); ?>assets/<?= $this->output->template_name() ?>/css/owl.transitions.css" media="all" />
	<link rel="stylesheet" href="<?= base_url(); ?>assets/<?= $this->output->template_name() ?>/css/common.css" media="all" />
	<link rel="stylesheet" href="<?= base_url(); ?>assets/<?= $this->output->template_name() ?>/css/style.css" media="all" />
	<link rel="stylesheet" href="<?= base_url(); ?>assets/<?= $this->output->template_name() ?>/css/layout_common.css?v=09-02-15" media="all" />
	<link rel="stylesheet" href="<?= base_url(); ?>assets/<?= $this->output->template_name() ?>/css/layout_desktop_tablet.css?v=13-01-15" media="all" />
	<link rel="stylesheet" href="<?= base_url(); ?>assets/<?= $this->output->template_name() ?>/css/layout_desktop_extra.css?v=13-01-15" media="all" />
	<link rel="stylesheet" href="<?= base_url(); ?>assets/<?= $this->output->template_name() ?>/css/layout_desktop.css?v=13-01-15" media="all" />
	<link rel="stylesheet" href="<?= base_url(); ?>assets/<?= $this->output->template_name() ?>/css/layout_tablet_mobile.css?v=13-01-15" media="all" />
	<link rel="stylesheet" href="<?= base_url(); ?>assets/<?= $this->output->template_name() ?>/css/layout_tablet.css?v=13-01-15" media="all" />
	<link rel="stylesheet" href="<?= base_url(); ?>assets/<?= $this->output->template_name() ?>/css/layout_mobile.css?v=13-01-15" media="all" />
	<link rel="stylesheet" href="<?= base_url(); ?>assets/<?= $this->output->template_name() ?>/css/style.css?v=13-01-15" media="all" />

	<?php
		foreach($css as $file)
		{
			echo "\n\t\t";
			echo link_tag($file);
		} echo "\n\t";
	?>

	<script src="<?= base_url(); ?>assets/<?= $this->output->template_name() ?>/js/jquery.min.js"></script>
	<script src="<?= base_url(); ?>assets/<?= $this->output->template_name() ?>/js/owl-carousel/owl.carousel.js?v=09-02-15"></script>
	<script src="<?= base_url(); ?>assets/<?= $this->output->template_name() ?>/js/function.js?v=09-02-15"></script>

	<?php
		foreach($js as $file)
		{
				echo "\n\t\t";
				?><script src="<?php echo $file; ?>"></script><?php
		} echo "\n\t";
		
		echo $inline_scripting;
	?>

	<script type="text/javascript">
		var url_root = '<?= base_url(); ?>';
	</script>

</head>
<body>
<div id="fb-root"></div>
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=6019344432519&amp;cd[value]=0.00&amp;cd[currency]=VND&amp;noscript=1" /></noscript>

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/vi_VN/all.js#xfbml=1&appId=657548844281713&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div id="page"><!-- closed footer.tpl -->
	<div id="header_root">
		<div class="header_root_inner clearfix">
			<div class="logo"><h1><a href="<?= base_url(); ?>index.php"><img src="<?= base_url(); ?>images/logo.png" alt="logo" /><span>{$site_short_name}</span></a></h1></div>
			<div class="rgt">
				<ul class="menu-root">
					<li><a href="<?= base_url(); ?>video/">Video</a></li>
					<li><a href="#">Ảnh đẹp</a></li>
					<li><a href="<?= base_url(); ?>index.php">Tin tức giới trẻ</a></li>
				</ul>
				<div class="login_btn"><a href="<?= siteUrl('user/login') ?>"><?= lang('login') ?></a></div>
			</div>
		</div>
	</div>
	<div id="header">
		<div class="header_banner">
		</div>
		<div id="navbar" class="navbar_inner clearfix">
			<div class="logo_space"><a href="<?= base_url(); ?>index.php"></a></div>
			<ul class="menu">
				<?php
					$catRoot = $this->category_model->getRoot();
					$catRoot[29] = $this->category_model->get(29);
					$catRoot[28] = $this->category_model->get(28);
					foreach($catRoot as $cat):
						$hasChild = !empty($cat->child);
				?>
					<li class="item<?= $cat->id ?> parent">
						<a href="<?= siteUrl('post/index/'.$cat->id) ?>"><?= $cat->title ?><?php if($hasChild) echo '<span class="arrow"></span>' ?></a>
						<div class="child">
							<div class="sub">
								<div class="parent_title"><?= $cat->title ?></div>
								<?php if($hasChild): ?>
									<ul>
									<?php foreach($cat->child as $child_id):
										$child = $this->category_model->get($child_id);
									?>
										<li><a href="<?= siteUrl('post/index/'.$child->id) ?>"><?= $child->title ?></a></li>
									<?php endforeach ?>
									</ul>
								<?php endif ?>
							</div>
							<div class="postItems clearfix">
								<?php
									$child_ids = $cat->child;
									if(!$child_ids)
									{
										$child_ids = array();
									}
									$child_ids[] = $cat->id;

									$this->post_model->list_where = 'type != 2 AND published = 1 AND category_id IN ( '.implode(', ', $child_ids).' )';
									$items = $this->post_model->getList(5);
									foreach($items as $itm):
										$link = siteUrl('post/detail/'.$itm->id.'-'.$itm->alias, $itm->category_id);
								?>
									<div class="item clearfix">
										<div class="postImage">
											<a href="<?= $link ?>">
												<img src="<?= thumb($itm->image, 130, 98) ?>" alt="<?= html_escape($itm->title) ?>" />
											</a>
										</div>
										<div class="postText">
											<h4><a href="<?= $link ?>"><?= $itm->title ?></a></h4>
											<div class="postDescription">
												<?= $itm->description ?>
											</div>
										</div>
									</div>
								<?php endforeach ?>
							</div>
						</div>
						
					</li>
				<?php endforeach ?>
				<li class="item-video parent">
					<a href="<?= base_url(); ?>video">video</a>
					<div class="child">
						<div class="sub">
							<div class="parent_title">Video</div>
						</div>
						<div class="postItems clearfix">
							<?php
								$this->post_model->list_where = 'type = 2 AND published = 1';
								$items = $this->post_model->getList(5);
								foreach($items as $itm):
									$link = siteUrl('post/detail/'.$itm->id, $itm->category_id);
							?>
							<div class="item clearfix">
								<div class="postImage">
									<a href="<?= $link ?>">
										<img src="http://img.youtube.com/vi/<?= $itm->link_youtube ?>/0.jpg" alt="<?= html_escape($itm->title) ?>" />
									</a>
								</div>
								<div class="postText">
									<h4><a href="<?= $link ?>"><?= $itm->title ?></a></h4>
									<div class="postDescription">
										<?= $itm->description ?>
									</div>
								</div>
							</div>
							<?php endforeach ?>
						</div>
					</div>
				</li>
			</ul>
			<div id="btn_pop"></div>
		</div><!--navbar-->
	</div><!-- header -->
	<div class="container"><!-- closed footer.tpl -->
		<div class="container_inner clearfix"><!-- closed footer.tpl -->
			<div class="container_top creafix">
				<div class="newsfeed creafix">
					<div class="static">Đừng bỏ lỡ</div>
					<div class="postItems clearfix" id="owl-newsfeed">
						<?php
							$this->post_model->list_where = 'hot >= 1 AND type != 2 AND published = 1';
							$this->post_model->list_orderby = array('rand()');
							$items = $this->post_model->getList(10);
							foreach($items as $itm):
						?>
							<div class="item"><a href="<?= siteUrl('post/detail/'.$itm->id.'-'.$itm->alias, $itm->category_id) ?>"><?= $itm->title ?></a></div>
						<?php endforeach ?>
					</div>
				</div><!-- newsfeed -->
				<div class="search clearfix">
					<form action="<?= siteUrl('post/search') ?>" method="get">
						<input type="text" name="keyword" placeholder="Nhập từ khóa cần tìm" />
						<button type="submit">Tìm kiếm</button>
					</form>
				</div>
			</div>
			<div class="container_padding">

				<?php echo $output;?>

				<div class="strange clearfix">
					<!-- Doc la -->
					<?php $strange = $this->category_model->get(6); ?>
					<div class="title_category clearfix">
						<h2><a href="<?= siteUrl('post/index/'.$strange->id) ?>"><?= $strange->title ?></a></h2>
						<div class="title_subcategories">
							<?php foreach($strange->child as $child_id):
								$child = $this->category_model->get($child_id); ?>
								<h3><a href="<?= siteUrl('post/index/'.$child->id) ?>"><?= $child->title ?></a></h3>
							<?php endforeach ?>
						</div>
					</div><!-- End title !-->
					<div class="postItems clearfix" id="owl-strange">
					<?php
						$child_ids = $strange->child;
						if(!$child_ids)
						{
							$child_ids = array();
						}
						$child_ids[] = $strange->id;

						$this->post_model->list_where = 'type != 2 AND published = 1 AND category_id IN ( '.implode(', ', $child_ids).' )';
						$items = $this->post_model->getList(12);
						foreach($items as $itm):
							$link = siteUrl('post/detail/'.$itm->id.'-'.$itm->alias, $itm->category_id);
					?>
						<div class="item">
							<div class="postImage">
								<a href="<?= $link ?>"><img alt="<?= html_escape($itm->title) ?>" src="<?= thumb($itm->image, 275, 206) ?>" alt="<?= html_escape($itm->title) ?>" /></a>
							</div>
							<div class="postText">
								<h4><a href="<?= $link ?>"><?= $itm->title ?></a></h4>
							</div>
						</div>
					<?php endforeach ?>
					</div>
				</div><!-- strange -->
			</div><!-- container_padding -->
		</div><!-- container_inner -->

	</div><!-- container / opened footer.tpl -->
		
	<div class="footer">
		<div class="nav-ft clearfix">
			<ul>
				<li class="logo_ft"><a href="<?= base_url(); ?>index.php"></a></li>
				<li class="set_home"><a href="javascript:;">Đặt làm trang chủ</a></li>
				<li class="newsletter"><a href="javascript:;">Nhận tin hàng ngày</a></li>
				<li class="contact"><a href="javascript:;">Liên hệ quảng cáo</a></li>
				<li class="rss"><a href="javascript:;">RSS</a></li>
			</ul>
		</div>
		<div class="menu-ft clearfix">
			<ul class="menu">
				<?php
					$catRoot = $this->category_model->getRoot();
					foreach($catRoot as $cat):
						$hasChild = !empty($cat->child);
				?>
					<li class="parent"><a href="<?= siteUrl('post/index/'.$cat->id) ?>"><?= $cat->title ?></a>
						<ul>
						<?php foreach($cat->child as $child_id):
							$child = $this->category_model->get($child_id);
						?>
							<li><a href="<?= siteUrl('post/index/'.$child->id) ?>"><?= $child->title ?></a></li>
						<?php endforeach ?>
						</ul>
					</li>
				<?php endforeach ?>
			</ul>
		</div>
		<div class="copy">
			<p>Copyright &copy; 2014 <strong>Myten.vn</strong></p>
			<p class="dmca"><script src="//images.dmca.com/Badges/DMCABadgeHelper.min.js"></script><a href="http://www.dmca.com/Protection/Status.aspx?ID=ab8b0dd0-23e4-454c-bde4-1059e4231d7f" title="DMCA.com Protection Program" class="dmca-badge"> <img src ="//images.dmca.com/Badges/dmca_protected_sml_120k.png?ID=ab8b0dd0-23e4-454c-bde4-1059e4231d7f"  alt="DMCA.com Protection Status" /></a></p>

		</div>

		{literal}
			<script>
			  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
			  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
			  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
			  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

			  ga('create', 'UA-44573424-13', 'auto');
			  ga('send', 'pageview');

			</script>
		{/literal}
	</div>
</div><!-- #page / opened footer.tpl -->

</body></html>

